<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
    //es5写法：给对象的值赋值
    var name = 'lzj';
    var age =  20;
    var obj ={
        name  : name ,
        age  : age,
    }
    document.writeln(obj.name + ''+obj.age);   

    var obj2={
        getmethod:function(){
            document.writeln("es5method")
        }
    }
    obj2.getmethod();

    //es6写法  
    var obj3 = {
        name ,
        age,
        getmethod(){
            document.writeln('es6 niubi');
        }
    }
    document.writeln(obj3.name);
    obj3.getmethod();
</script>

</body>
</html>